<template>

	<div style="position: fixed;width:100%;height: 100%;background: #09204d;">

		<el-row style="width:100%;height:100%">
			<el-col :span="4" style="height: 100%;"></el-col>
			<el-col :span="16" style="height: 100%;">
				<div style="height: 50%;width:50%;margin-left: 25%;margin-top: 15%">
					<div class="demo-input-suffix">

						<el-input placeholder="请输入姓名" v-model="loginData.LoginName">

						</el-input>
						<el-input type="password" placeholder="请输入密码" v-model="loginData.Pwd" style="margin-top: 30px;">

						</el-input>
						<el-button type="primary" style="margin-top: 30px;width:100%"  @click="login">登录</el-button>
					</div>
				</div>
			</el-col>
			<el-col :span="4" style="height: 100%;"></el-col>
		</el-row>

	</div>

</template>

<script>
	export default {
		data() {
			return {
				loginData: {
					LoginName: "",
					Pwd: ""
				}
			}
		},
		methods: {
			login() {
				let that = this
				debugger
				this.$httpRequest.post('api/User/Login', this.loginData, response => {
					
					if(response.isSuccess) {
						this.$notify({
							title: '用户登录',
							message: '成功',
							type: 'success'
						});
						that.$router.push('/Navi');
					} else {
						this.$notify.error({
							title: '错误',
							message: '密码错误'
						});
					}
				});
			}
		},
		created(){
			var lett = this;
document.onkeydown = function(e) {
var key = window.event.keyCode;
if (key == 13) {
lett.login();
}
}
		}
	}
</script>

<style>

</style>